<?php
namespace Common\Mysql;
use Think\Model;
class CommonMysql extends Model{
    protected $connection = 'MYSQL';
    protected $sid = 0;
    public function __construct() {
        parent::__construct();
    }

    protected function addRecord($data,$return = true,$msg = '') {
        $result = $this->add($data);

        if($result === false && $return === false) {
            E($msg?$msg:$this->getDbError());
        }

        return $result;
    }

    protected function updateRecord($data,$return = true,$msg = '') {
        $result = $this->save($data);

        if($result === false && $return === false) {
            E($msg?$msg:$this->getDbError());
        }

        return $result;
    }

    public function getList($where = array(),$field = null,$order = null) {
        return $this->where($where)->field($field)->order($order)->select();
    }
}
?>
